﻿@model Bricks.Site.Models.ParamSetting.SystemParamView

@{
    ViewBag.Title = "系统参数";
    Layout = "~/Views/Shared/_UserPage.cshtml";
    //Layout = null;
}

@*引入kindeditor*@
@*<link href="~/Res/kindeditor/themes/default/default.css" rel="stylesheet" />
<script src="~/Res/kindeditor/kindeditor-all-min.js"></script>
<script src="~/Res/kindeditor/lang/zh_CN.js"></script>
<script src="~/Res/kindeditor/plugins/code/prettify.js"></script>*@
@*<script src="@Url.Content("~/Res/scripts/jquery.common.js")"></script>*@

@*引入uEditor*@
<script type="text/javascript" charset="utf-8" src="/Res/ueditor/ueditor.config.js"></script>
<script type="text/javascript" charset="utf-8" src="/Res/ueditor/ueditor.all.js"> </script>
<script type="text/javascript" charset="utf-8" src="/Res/ueditor/lang/zh-cn/zh-cn.js"></script>

<script src="@Url.Content("~/Res/easyui/expands/common.js")"></script>

<script type="text/javascript">
    //为什么这里在使用Dialog打开的时候启动不了呢？
    $(function () {
        //这个实际没有运行成功
        //$.EditorInit("#SystemCopyright", 350, "p", false, "SystemParam");  //初始化KindEditor（SystemParam参数是测试文件上传路径）

        $.MiniUEditorInit("SystemCopyright");  //迷你加载
    });

    //保存
    function Save() {
        //$.post("/ParamSetting/SystemParamPost");
        //KindEditor.sync("#SystemCopyright");  //同步富文本编辑器，否则无法获取值
        $("#form-systemParam").form("submit", {
            url: "/ParamSetting/SystemParamPost",
            success: function (result) {
                try {
                    result = JSON.parse(result);
                    if (result.ResultType == 0) {  //ResultType是在OperationResultType定义的，0表示Success成功
                        //$.EasyuiSlide(result.Message);  //弹出右下角提示
                        //$.EasyuiMsg(result.Message);  //弹出提示窗体
                        //options.success(result);
                        //$.ButtonCloseDialog(options.button);
                        Close();
                    }
                    else {
                        $.EasyuiMsg(result.Message);  //弹出提示窗体
                    }
                } catch (e) { $.Error(result); }
            }
        });
    }

    //关闭
    function Close() {
        //debugger;
        //$('#myWindow').dialog('close');
        parent.$('#myWindow').window('close');
    }
</script>

<div class="frombox datagrid-body" style="padding-bottom: 5px;">
    <form id="form-systemParam" method="post">
        <table class="datagrid-btable" border="0" cellspacing="0" cellpadding="0" width="100%">
            <tr class="datagrid-row">
                <td class="th" style="width: 100px">
                    <div class="datagrid-cell">系统名称</div>
                </td>
                <td class="td">
                    <div class="datagrid-cell">
                        <input name="SystemName" id="SystemName" class="easyui-validatebox" data-options="required:true" value="@Model.SystemName" />
                    </div>
                </td>
            </tr>
            <tr class="datagrid-row">
                <td class="th" style="width: 100px">
                    <div class="datagrid-cell">产品密钥</div>
                </td>
                <td class="td">
                    <div class="datagrid-cell">
                        @*<input id="SystemKey" name="SystemKey" class="easyui-validatebox" data-options="required:true" value="@Model.SystemKey" />*@
                        <input id="SystemKey" name="SystemKey" class="easyui-textbox" value="@Model.SystemKey" />
                    </div>
                </td>
            </tr>
            <tr class="datagrid-row">
                <td class="th" style="width: 100px">
                    <div class="datagrid-cell">版权信息</div>
                </td>
                <td class="td">
                    <div class="datagrid-cell">
                        <label style="color: blue;">请在下方编辑器输入</label>
                    </div>
                </td>
            </tr>
            <tr class="datagrid-row">
                <td class="text" colspan="2">
                    <div class="datagrid-cell">
                        <textarea id="SystemCopyright" name="SystemCopyright">@Model.SystemCopyright</textarea>
                    </div>
                </td>
            </tr>
            <tr class="datagrid-row">
                <td class="text" colspan="2">
                    <div class="datagrid-cell">
                        <a id="btnSave" href="#" class="easyui-linkbutton" data-options="iconCls:'icon-ok'" onclick="Save()">保存</a>
                        <a id="btnClose" href="#" class="easyui-linkbutton" data-options="iconCls:'icon-no'" onclick="Close()">关闭</a>
                    </div>
                </td>
            </tr>
        </table>
    </form>
</div>
